<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<%=request.getContextPath() %>/styles/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="css/text"/>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-ui-calendar.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#form").submit(function(){
		var formOptions={
		        beforeSubmit:  showRequest,  // pre-submit callback 
		        success:showResponse,  // post-submit callback 
		        dataType:'json',
		        error:showError,
		        resetForm: true        // reset the form after successful submit 
		}
		$(this).ajaxSubmit(formOptions);
		return false;
	});
	
	$("#tanggal").datepicker({dateFormat:"dd-mm-yy"});
});

function showRequest(){
	return true;
}

function showResponse(data){
	if(data.success){
		showNoticeMessage("Data Saved!");
	}
}

function showError(xhr,data,errorThrown){
	showErrorMessage("Save failed, reason:"+errorThrown);
}
</script>
<title>User Management</title>
</head>
<body>
	<div class="secondary-navigation">
		<ul class="wat-cf">
			<li class="first active"><a href="/admin/holidays">Add</a></li>
			<li><a href="/admin/holidays/list">List</a></li>
		</ul>
	</div>
	<div class="block" id="block-form">
		<div class="content">
			<div class="flash"></div>
			<div class="inner">
				<h2 class="title">Holiday Management</h2>
				<form:form id="form" cssClass="form" modelAttribute="holidaysModel" method="post"  action="/service/holiday/insert">
					<div class="group">
						<form:label path="tanggal" for="tanggal" cssClass="label">Tanggal</form:label>
						<form:input id="tanggal" path="tanggal" />
						<span class="description">dd-MM-yyyy</span>
					</div>
					<div class="group">
						<form:label path="description" for="description" cssClass="label">Desription</form:label>
						<form:textarea path="description" cssClass="text_area" />
						<span class="description"></span>
					</div>
					<div class="group navform wat-cf">
						<button class="button" type="submit">
							<img src="/images/icons/tick.png" alt="Save"> Save
						</button>
						<button class="button" type="reset">Reset</button>
					</div>
				</form:form>
			</div>
		</div>
	</div>
</body>
</html>